package com.bookcloud.java21.chapter12.泛型类层次126;

public class UserRepositoryExample {
  public static void main(String[] args) {
    GenericRepository<User> userRepository = new UserRepository();
    // 保存用户
    User user = new User(1L, "张三", 18);
    userRepository.save(user);
    System.out.println("打印出userList:" + userRepository.findAll());
    // 更新用户
    user.setName("李四");
    userRepository.update(user.getId(), user);
    System.out.println("打印出userList:" + userRepository.findAll());
    // 删除用户
    userRepository.delete(user.getId());
    System.out.println("打印出userList:" + userRepository.findAll());
  }
}
